USE [HomestayWebDB]
GO

/****** Object:  View [dbo].[Post_GetEditPost_View]    Script Date: 11/26/2012 17:36:55 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO



ALTER VIEW [dbo].[Post_GetEditPost_View]
AS
SELECT	Posts.PostID
		,Posts.Username AS Posts_Username
		,Posts.Title AS Posts_Title
		,ISNULL(Posts.Content,'') AS Posts_Content
		,ISNULL(Posts.ContactName,'') AS Posts_ContactName
		,ISNULL(Posts.MobilePhone,'') AS Posts_MobilePhone
		,ISNULL(Posts.TelePhone,'') AS Posts_TelePhone
		,ISNULL(Posts.ContactEmail,'') AS Posts_Email
		,ISNULL(Posts.IsAvailable,CAST(0 AS BIT)) AS Posts_Available
		,Houses.TypeOfHouseID AS Houses_TypeOfHouseID
		,ISNULL(Houses.Area,0) AS Houses_Area
		,Houses.Province AS Houses_Province
		,Houses.District AS Houses_District
		,ISNULL(Houses.AddressDetail,0) AS Houses_AddressDetail
		,ISNULL(Houses.PricePerDay,0) AS Houses_PricePerDay
		,ISNULL(Houses.PricePerWeek,0) AS Houses_PricePerWeek
		,ISNULL(Houses.PricePerMonth,0) AS Houses_PricePerMonth
		,ISNULL(Houses.NumSittingRoom,0) AS Houses_NumSittingRoom
		,ISNULL(Houses.NumBadroom,0) AS Houses_NumBadroom
		,ISNULL(Houses.Storey,0) AS Houses_Storey
		,ISNULL(Houses.NumOfWC,0) AS Houses_NumOfWC
		,ISNULL(Houses.HasGara,CAST(0 AS BIT)) AS Houses_HasGara
		,ISNULL(Houses.HasGarden,CAST(0 AS BIT)) AS Houses_HasGarden
		,ISNULL(Houses.HasKitchen,CAST(0 AS BIT)) AS Houses_HasKitchen
		,ISNULL(Houses.Ordinate,'') AS Houses_Ordinate
FROM Posts
	LEFT JOIN Houses ON (Posts.HouseID = Houses.HouseID)
WHERE Houses.IsDeleted = CAST(0 AS BIT)
	AND Posts.IsDeleted = CAST(0 AS BIT)


GO


